import com.lijinjiang.JDatePicker;
import com.lijinjiang.beautyeye.BeautyEyeLNFHelper;
import com.lijinjiang.mode.PickerMode;

import javax.swing.*;
import java.awt.*;
import java.time.LocalDateTime;

/**
 * @Description 测试案例
 * @Author 03010430
 * @Date 2024-10-29 15:27
 */
public class PickWithDefaultDemo {
    public static void main(String[] args) {
        try {
            //BeautyEye LAF外观
            BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow;
            BeautyEyeLNFHelper.launchBeautyEyeLNF();
            //Windows外观
            //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (Exception ignored) {
        }
        JFrame frame = new JFrame();
        frame.setLayout(new BorderLayout());
        frame.setTitle("选择秒");
        frame.setSize(400, 360);

        JDatePicker picker = new JDatePicker(PickerMode.SECOND, LocalDateTime.of(2024, 6, 6, 6, 6, 6));//默认值
        frame.add(picker, BorderLayout.NORTH);

        JPanel centerPanel = new JPanel();
        JButton button = new JButton("取值");
        button.setPreferredSize(new Dimension(80, 32));
        button.addActionListener(e -> JOptionPane.showMessageDialog(frame, picker.getValue()));
        centerPanel.add(button);
        frame.add(centerPanel, BorderLayout.CENTER);

        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}
